/*
 ============================================================================
 Page	     : 250-251
 Name        : lesser.c
 Date	     : 20210404
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 找出两个整数中较小的一个
 ============================================================================
 */

#include <stdio.h>
int imin(int, int);

int main(void)
{
	int evil1 = 0;
	int evil2 = 0;

	printf("Enter a pair of integers (q to quit):\n");
	while(scanf("%d %d", &evil1, &evil2) == 2)
	{
		printf("The lesser of %d and %d is %d.\n", evil1, evil2, imin(evil1, evil2));
		printf("Enter a pair of integers (q to quit):\n");
	}
	printf("Bye.\n");

	return 0;
}

int imin(int n, int m)
{
	int min = 0;

	if(n < m)
	{
		min = n;
	}
	else
	{
		min = m;
	}

	return min;
}

